from django.urls import path
from rest_framework.routers import DefaultRouter
from shopping.views import *

urlpatterns = [
    path('payment/<pk>/', PaymentViewSet.as_view({'get': 'retrieve'})),
    path('payment/', PaymentViewSet.as_view({'put': 'update'})),
]
router = DefaultRouter()
# 如果没有设置basename将会使用基于views视图集中的queryset属性
# 如果不使用queryset属性，自定义get_queryset方法，那么必须设置basename属性
router.register('classification', ClassificationViewSet)
router.register('classifications', ClassificationStudentViewSet)
router.register('commodity', CommodityViewSet)
router.register('commoditys', CommodityStudentViewSet)
router.register('cart', ShoppingCartViewSet, basename='cart')
router.register('order', OrderViewSet, basename='order')
urlpatterns += router.urls
